//
// Created by tongj on 2024/1/13.
//

#ifndef _LOCK_CUH_
#define _LOCK_CUH_
template<typename T> WriteLockGuard<T> make_write_lock_guard(WriteReadLock<T> &l) {
  return WriteLockGuard<T>(&l);
}
template<typename T> ReadLockGuard<T> make_read_lock_guard(WriteReadLock<T> &l) {
  return ReadLockGuard<T>(&l);
}

template<typename TL> CommonLockGuard<TL> make_lock_guard(TL &lock) {
  return CommonLockGuard<TL>(&lock);
}

template<typename TL> void COMMON_LOCKER_RELEASE(TL *tl) {
  if (tl != nullptr) {
	tl->unlock(COMMON_LOCK_TYPE);
  }
}
template<typename TL> void COMMON_LOCKER_LOCK(TL *tl) {
  if (tl != nullptr) {
	tl->lock(COMMON_LOCK_TYPE);
  }
}
#endif //_LOCK_CUH_
